"""thor URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from blog import views as blog_views
from comment import views as comment_views
from .custom_site import custom_site
from django.contrib.sitemaps import views as sitemap_views
from blog.rss import LatestPostFeed
from blog.sitemap import PostSitemap

urlpatterns = [
    path('super_admin/', admin.site.urls),
    path('admin/', custom_site.urls),
    path('', blog_views.IndexView.as_view(), name="index"),
    path('post/<int:post_id>/',
         blog_views.PostDetailView.as_view(),
         name="post-detail"),
    # 分类
    path('category/<int:category_id>',
         blog_views.CategoryView.as_view(),
         name="category-list"),
    # 标签
    path('tag/<int:tag_id>', blog_views.TagView.as_view(), name="tag-list"),
    # 搜索
    path('search/', blog_views.SearchView.as_view(), name="search"),
    # 作者文章页
    path('author/<int:author_id>',
         blog_views.AuthorView.as_view(),
         name="author"),
    # 友情链接
    path('links/', blog_views.LinkListView.as_view(), name="links"),
    path('comment/', comment_views.CommentView.as_view(), name="comment"),
    path('rss/', LatestPostFeed(), name="rss"),
    path('sitemap.xml', sitemap_views.sitemap,
         {"sitemaps": {
             "posts": PostSitemap
         }}),
]
